package com.effective.java.singleton;

import java.io.Serializable;

/**
 * Created by Administrator on 2017/5/23.
 */
public class SingletonB implements Serializable {

    private static SingletonB instance = new SingletonB();

    private SingletonB() {}

    public static SingletonB getInstance() {
        return instance;
    }

    // 不添加该方法则会出现 反序列化时出现多个实例的问题
    public Object readResolve() {
        return instance;
    }
}
